using System;
using System.Xml;

namespace Mbs.CastleContainer
{
    class DefinedProcessingInstructionProcessor : AbstractXmlNodeProcessor
    {
        private static readonly XmlNodeType[] acceptNodes = new XmlNodeType[] { XmlNodeType.ProcessingInstruction };

        public DefinedProcessingInstructionProcessor()
        {
        }

        public override String Name
        {
            get { return "define"; }
        }

        public override XmlNodeType[] AcceptNodeTypes
        {
            get { return acceptNodes; }
        }

        public override void Process(IXmlProcessorNodeList nodeList, IXmlProcessorEngine engine)
        {
            XmlProcessingInstruction node = nodeList.Current as XmlProcessingInstruction;

            engine.AddFlag(node.Data);

            RemoveItSelf(node);
        }
    }
}
